iommu = find_iommu_for_device(bdf);
if ( !iommu )
{
- amd_iov_error("IVMD Error: No IOMMU for Dev_Id 0x%x!\n", bdf);
+ AMD_IOMMU_DEBUG("IVMD Error: No IOMMU for Dev_Id 0x%x!\n", bdf);
return -ENODEV;
}
req = ivrs_mappings[bdf].dte_requestor_id;
bdf = ivmd_block->header.dev_id;
if ( bdf >= ivrs_bdf_entries )
{
- amd_iov_error("IVMD Error: Invalid Dev_Id 0x%x\n", bdf);
+ AMD_IOMMU_DEBUG("IVMD Error: Invalid Dev_Id 0x%x\n", bdf);
return -ENODEV;
}
first_bdf = ivmd_block->header.dev_id;
if ( first_bdf >= ivrs_bdf_entries )
{
- amd_iov_error(
+ AMD_IOMMU_DEBUG(
"IVMD Error: Invalid Range_First Dev_Id 0x%x\n", first_bdf);
return -ENODEV;
}
last_bdf = ivmd_block->last_dev_id;
if ( (last_bdf >= ivrs_bdf_entries) || (last_bdf <= first_bdf) )
{
- amd_iov_error(
+ AMD_IOMMU_DEBUG(
"IVMD Error: Invalid Range_Last Dev_Id 0x%x\n", last_bdf);
return -ENODEV;
}
ivmd_block->cap_offset);
if ( !iommu )
{
- amd_iov_error("IVMD Error: No IOMMU for Dev_Id 0x%x Cap 0x%x\n",
+ AMD_IOMMU_DEBUG("IVMD Error: No IOMMU for Dev_Id 0x%x Cap 0x%x\n",
ivmd_block->header.dev_id, ivmd_block->cap_offset);
return -ENODEV;
}
if ( ivmd_block->header.length <
sizeof(struct acpi_ivmd_block_header) )
{
- amd_iov_error("IVMD Error: Invalid Block Length!\n");
+ AMD_IOMMU_DEBUG("IVMD Error: Invalid Block Length!\n");
return -ENODEV;
}
base = start_addr & PAGE_MASK;
limit = (start_addr + mem_length - 1) & PAGE_MASK;
- amd_iov_info("IVMD Block: Type 0x%x\n",ivmd_block->header.type);
- amd_iov_info(" Start_Addr_Phys 0x%lx\n", start_addr);
- amd_iov_info(" Mem_Length 0x%lx\n", mem_length);
+ AMD_IOMMU_DEBUG("IVMD Block: Type 0x%x\n",ivmd_block->header.type);
+ AMD_IOMMU_DEBUG(" Start_Addr_Phys 0x%lx\n", start_addr);
+ AMD_IOMMU_DEBUG(" Mem_Length 0x%lx\n", mem_length);
if ( get_field_from_byte(ivmd_block->header.flags,
AMD_IOMMU_ACPI_EXCLUSION_RANGE_MASK,
}
else
{
- amd_iov_error("IVMD Error: Invalid Flag Field!\n");
+ AMD_IOMMU_DEBUG("IVMD Error: Invalid Flag Field!\n");
return -ENODEV;
}
base, limit, iw, ir);
default:
- amd_iov_error("IVMD Error: Invalid Block Type!\n");
+ AMD_IOMMU_DEBUG("IVMD Error: Invalid Block Type!\n");
return -ENODEV;
}
}
{
if ( header_length < (block_length + pad_length) )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Length!\n");
return 0;
}
bdf = ivhd_device->header.dev_id;
if ( bdf >= ivrs_bdf_entries )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf);
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf);
return 0;
}
dev_length = sizeof(struct acpi_ivhd_device_range);
if ( header_length < (block_length + dev_length) )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Length!\n");
return 0;
}
if ( ivhd_device->range.trailer.type !=
AMD_IOMMU_ACPI_IVHD_DEV_RANGE_END )
{
- amd_iov_error("IVHD Error: "
+ AMD_IOMMU_DEBUG("IVHD Error: "
"Invalid Range: End_Type 0x%x\n",
ivhd_device->range.trailer.type);
return 0;
first_bdf = ivhd_device->header.dev_id;
if ( first_bdf >= ivrs_bdf_entries )
{
- amd_iov_error(
+ AMD_IOMMU_DEBUG(
"IVHD Error: Invalid Range: First Dev_Id 0x%x\n", first_bdf);
return 0;
}
last_bdf = ivhd_device->range.trailer.dev_id;
if ( (last_bdf >= ivrs_bdf_entries) || (last_bdf <= first_bdf) )
{
- amd_iov_error(
+ AMD_IOMMU_DEBUG(
"IVHD Error: Invalid Range: Last Dev_Id 0x%x\n", last_bdf);
return 0;
}
- amd_iov_info(" Dev_Id Range: 0x%x -> 0x%x\n", first_bdf, last_bdf);
+ AMD_IOMMU_DEBUG(" Dev_Id Range: 0x%x -> 0x%x\n", first_bdf, last_bdf);
for ( bdf = first_bdf; bdf <= last_bdf; bdf++ )
add_ivrs_mapping_entry(bdf, bdf, ivhd_device->header.flags, iommu);
dev_length = sizeof(struct acpi_ivhd_device_alias);
if ( header_length < (block_length + dev_length) )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Length!\n");
return 0;
}
bdf = ivhd_device->header.dev_id;
if ( bdf >= ivrs_bdf_entries )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf);
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf);
return 0;
}
alias_id = ivhd_device->alias.dev_id;
if ( alias_id >= ivrs_bdf_entries )
{
- amd_iov_error("IVHD Error: Invalid Alias Dev_Id 0x%x\n", alias_id);
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Alias Dev_Id 0x%x\n", alias_id);
return 0;
}
- amd_iov_info(" Dev_Id Alias: 0x%x\n", alias_id);
+ AMD_IOMMU_DEBUG(" Dev_Id Alias: 0x%x\n", alias_id);
add_ivrs_mapping_entry(bdf, alias_id, ivhd_device->header.flags, iommu);
dev_length = sizeof(struct acpi_ivhd_device_alias_range);
if ( header_length < (block_length + dev_length) )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Length!\n");
return 0;
}
if ( ivhd_device->alias_range.trailer.type !=
AMD_IOMMU_ACPI_IVHD_DEV_RANGE_END )
{
- amd_iov_error("IVHD Error: "
+ AMD_IOMMU_DEBUG("IVHD Error: "
"Invalid Range: End_Type 0x%x\n",
ivhd_device->alias_range.trailer.type);
return 0;
first_bdf = ivhd_device->header.dev_id;
if ( first_bdf >= ivrs_bdf_entries )
{
- amd_iov_error(
+ AMD_IOMMU_DEBUG(
"IVHD Error: Invalid Range: First Dev_Id 0x%x\n", first_bdf);
return 0;
}
last_bdf = ivhd_device->alias_range.trailer.dev_id;
if ( last_bdf >= ivrs_bdf_entries || last_bdf <= first_bdf )
{
- amd_iov_error(
+ AMD_IOMMU_DEBUG(
"IVHD Error: Invalid Range: Last Dev_Id 0x%x\n", last_bdf);
return 0;
}
alias_id = ivhd_device->alias_range.alias.dev_id;
if ( alias_id >= ivrs_bdf_entries )
{
- amd_iov_error("IVHD Error: Invalid Alias Dev_Id 0x%x\n", alias_id);
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Alias Dev_Id 0x%x\n", alias_id);
return 0;
}
- amd_iov_info(" Dev_Id Range: 0x%x -> 0x%x\n", first_bdf, last_bdf);
- amd_iov_info(" Dev_Id Alias: 0x%x\n", alias_id);
+ AMD_IOMMU_DEBUG(" Dev_Id Range: 0x%x -> 0x%x\n", first_bdf, last_bdf);
+ AMD_IOMMU_DEBUG(" Dev_Id Alias: 0x%x\n", alias_id);
for ( bdf = first_bdf; bdf <= last_bdf; bdf++ )
add_ivrs_mapping_entry(bdf, alias_id, ivhd_device->header.flags, iommu);
dev_length = sizeof(struct acpi_ivhd_device_extended);
if ( header_length < (block_length + dev_length) )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Length!\n");
return 0;
}
bdf = ivhd_device->header.dev_id;
if ( bdf >= ivrs_bdf_entries )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf);
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf);
return 0;
}
dev_length = sizeof(struct acpi_ivhd_device_extended_range);
if ( header_length < (block_length + dev_length) )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Length!\n");
return 0;
}
if ( ivhd_device->extended_range.trailer.type !=
AMD_IOMMU_ACPI_IVHD_DEV_RANGE_END )
{
- amd_iov_error("IVHD Error: "
+ AMD_IOMMU_DEBUG("IVHD Error: "
"Invalid Range: End_Type 0x%x\n",
ivhd_device->extended_range.trailer.type);
return 0;
first_bdf = ivhd_device->header.dev_id;
if ( first_bdf >= ivrs_bdf_entries )
{
- amd_iov_error(
+ AMD_IOMMU_DEBUG(
"IVHD Error: Invalid Range: First Dev_Id 0x%x\n", first_bdf);
return 0;
}
last_bdf = ivhd_device->extended_range.trailer.dev_id;
if ( (last_bdf >= ivrs_bdf_entries) || (last_bdf <= first_bdf) )
{
- amd_iov_error(
+ AMD_IOMMU_DEBUG(
"IVHD Error: Invalid Range: Last Dev_Id 0x%x\n", last_bdf);
return 0;
}
- amd_iov_info(" Dev_Id Range: 0x%x -> 0x%x\n",
+ AMD_IOMMU_DEBUG(" Dev_Id Range: 0x%x -> 0x%x\n",
first_bdf, last_bdf);
for ( bdf = first_bdf; bdf <= last_bdf; bdf++ )
dev_length = sizeof(struct acpi_ivhd_device_special);
if ( header_length < (block_length + dev_length) )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Length!\n");
return 0;
}
bdf = ivhd_device->special.dev_id;
if ( bdf >= ivrs_bdf_entries )
{
- amd_iov_error("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf);
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf);
return 0;
}
if ( ivhd_block->header.length <
sizeof(struct acpi_ivhd_block_header) )
{
- amd_iov_error("IVHD Error: Invalid Block Length!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Block Length!\n");
return -ENODEV;
}
ivhd_block->cap_offset);
if ( !iommu )
{
- amd_iov_error("IVHD Error: No IOMMU for Dev_Id 0x%x Cap 0x%x\n",
+ AMD_IOMMU_DEBUG("IVHD Error: No IOMMU for Dev_Id 0x%x Cap 0x%x\n",
ivhd_block->header.dev_id, ivhd_block->cap_offset);
return -ENODEV;
}
ivhd_device = (union acpi_ivhd_device *)
((u8 *)ivhd_block + block_length);
- amd_iov_info( "IVHD Device Entry:\n");
- amd_iov_info( " Type 0x%x\n", ivhd_device->header.type);
- amd_iov_info( " Dev_Id 0x%x\n", ivhd_device->header.dev_id);
- amd_iov_info( " Flags 0x%x\n", ivhd_device->header.flags);
+ AMD_IOMMU_DEBUG( "IVHD Device Entry:\n");
+ AMD_IOMMU_DEBUG( " Type 0x%x\n", ivhd_device->header.type);
+ AMD_IOMMU_DEBUG( " Dev_Id 0x%x\n", ivhd_device->header.dev_id);
+ AMD_IOMMU_DEBUG( " Flags 0x%x\n", ivhd_device->header.flags);
switch ( ivhd_device->header.type )
{
ivhd_block->header.length, block_length, iommu);
break;
default:
- amd_iov_error("IVHD Error: Invalid Device Type!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device Type!\n");
dev_length = 0;
break;
}
return parse_ivmd_block(ivmd_block);
default:
- amd_iov_error("IVRS Error: Invalid Block Type!\n");
+ AMD_IOMMU_DEBUG("IVRS Error: Invalid Block Type!\n");
return -ENODEV;
}
static void __init dump_acpi_table_header(struct acpi_table_header *table)
{
-#ifdef AMD_IOV_DEBUG
int i;
- amd_iov_info("ACPI Table:\n");
- amd_iov_info(" Signature ");
+ AMD_IOMMU_DEBUG("ACPI Table:\n");
+ AMD_IOMMU_DEBUG(" Signature ");
for ( i = 0; i < ACPI_NAME_SIZE; i++ )
printk("%c", table->signature[i]);
printk("\n");
- amd_iov_info(" Length 0x%x\n", table->length);
- amd_iov_info(" Revision 0x%x\n", table->revision);
- amd_iov_info(" CheckSum 0x%x\n", table->checksum);
+ AMD_IOMMU_DEBUG(" Length 0x%x\n", table->length);
+ AMD_IOMMU_DEBUG(" Revision 0x%x\n", table->revision);
+ AMD_IOMMU_DEBUG(" CheckSum 0x%x\n", table->checksum);
- amd_iov_info(" OEM_Id ");
+ AMD_IOMMU_DEBUG(" OEM_Id ");
for ( i = 0; i < ACPI_OEM_ID_SIZE; i++ )
printk("%c", table->oem_id[i]);
printk("\n");
- amd_iov_info(" OEM_Table_Id ");
+ AMD_IOMMU_DEBUG(" OEM_Table_Id ");
for ( i = 0; i < ACPI_OEM_TABLE_ID_SIZE; i++ )
printk("%c", table->oem_table_id[i]);
printk("\n");
- amd_iov_info(" OEM_Revision 0x%x\n", table->oem_revision);
+ AMD_IOMMU_DEBUG(" OEM_Revision 0x%x\n", table->oem_revision);
- amd_iov_info(" Creator_Id ");
+ AMD_IOMMU_DEBUG(" Creator_Id ");
for ( i = 0; i < ACPI_NAME_SIZE; i++ )
printk("%c", table->asl_compiler_id[i]);
printk("\n");
- amd_iov_info(" Creator_Revision 0x%x\n",
+ AMD_IOMMU_DEBUG(" Creator_Revision 0x%x\n",
table->asl_compiler_revision);
-#endif
}
BUG_ON(!table);
- dump_acpi_table_header(table);
+ if ( amd_iommu_debug )
+ dump_acpi_table_header(table);
/* parse IVRS blocks */
length = sizeof(struct acpi_ivrs_table_header);
ivrs_block = (struct acpi_ivrs_block_header *)
((u8 *)table + length);
- amd_iov_info("IVRS Block:\n");
- amd_iov_info(" Type 0x%x\n", ivrs_block->type);
- amd_iov_info(" Flags 0x%x\n", ivrs_block->flags);
- amd_iov_info(" Length 0x%x\n", ivrs_block->length);
- amd_iov_info(" Dev_Id 0x%x\n", ivrs_block->dev_id);
+ AMD_IOMMU_DEBUG("IVRS Block:\n");
+ AMD_IOMMU_DEBUG(" Type 0x%x\n", ivrs_block->type);
+ AMD_IOMMU_DEBUG(" Flags 0x%x\n", ivrs_block->flags);
+ AMD_IOMMU_DEBUG(" Length 0x%x\n", ivrs_block->length);
+ AMD_IOMMU_DEBUG(" Dev_Id 0x%x\n", ivrs_block->dev_id);
if ( table->length < (length + ivrs_block->length) )
{
- amd_iov_error("IVRS Error: "
+ AMD_IOMMU_DEBUG("IVRS Error: "
"Table Length Exceeded: 0x%x -> 0x%lx\n",
table->length,
(length + ivrs_block->length));
checksum += raw_table[i];
if ( checksum )
{
- amd_iov_error("IVRS Error: "
+ AMD_IOMMU_DEBUG("IVRS Error: "
"Invalid Checksum 0x%x\n", checksum);
return -ENODEV;
}
if ( ivhd_block->header.length <
sizeof(struct acpi_ivhd_block_header) )
{
- amd_iov_error("IVHD Error: Invalid Block Length!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Block Length!\n");
return -ENODEV;
}
dev_length = sizeof(struct acpi_ivhd_device_special);
break;
default:
- amd_iov_error("IVHD Error: Invalid Device Type!\n");
+ AMD_IOMMU_DEBUG("IVHD Error: Invalid Device Type!\n");
dev_length = 0;
break;
}
invalidate_dev_table_entry(iommu, req_id);
flush_command_buffer(iommu);
- amd_iov_info("Setup I/O page table at DTE:0x%x, root_table:%"PRIx64","
+ AMD_IOMMU_DEBUG("Setup I/O page table at DTE:0x%x, root_table:%"PRIx64","
"domain_id:%d, paging_mode:%d\n", req_id,
page_to_maddr(hd->root_table), hd->domain_id, hd->paging_mode);
}
if ( !iommu )
{
- amd_iov_warning("Fail to find iommu for device"
+ AMD_IOMMU_DEBUG("Fail to find iommu for device"
"%02x:%02x.%x\n", bus, dev, func);
continue;
}
if ( amd_iommu_detect_acpi() != 0 )
{
- amd_iov_error("Error detection\n");
+ AMD_IOMMU_DEBUG("Error detection\n");
return -ENODEV;
}
if ( amd_iommu_init() != 0 )
{
- amd_iov_error("Error initialization\n");
+ AMD_IOMMU_DEBUG("Error initialization\n");
return -ENODEV;
}
return 0;
disable_translation((u32 *)dte);
invalidate_dev_table_entry(iommu, req_id);
flush_command_buffer(iommu);
- amd_iov_info("Disable DTE:0x%x,"
+ AMD_IOMMU_DEBUG("Disable DTE:0x%x,"
" domain_id:%d, paging_mode:%d\n",
req_id, domain_hvm_iommu(domain)->domain_id,
domain_hvm_iommu(domain)->paging_mode);
iommu = find_iommu_for_device(bdf);
if ( !iommu )
{
- amd_iov_error("Fail to find iommu."
+ AMD_IOMMU_DEBUG("Fail to find iommu."
" %x:%x.%x cannot be assigned to domain %d\n",
bus, PCI_SLOT(devfn), PCI_FUNC(devfn), target->domain_id);
return -ENODEV;
pdev->domain = target;
amd_iommu_setup_domain_device(target, iommu, bdf);
- amd_iov_info("reassign %x:%x.%x domain %d -> domain %d\n",
+ AMD_IOMMU_DEBUG("reassign %x:%x.%x domain %d -> domain %d\n",
bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
source->domain_id, target->domain_id);
iommu = find_iommu_for_device(bdf);
if ( !iommu )
{
- amd_iov_error("Fail to find iommu."
+ AMD_IOMMU_DEBUG("Fail to find iommu."
" %x:%x.%x cannot be assigned to domain %d\n",
pdev->bus, PCI_SLOT(pdev->devfn),
PCI_FUNC(pdev->devfn), pdev->domain->domain_id);
iommu = find_iommu_for_device(bdf);
if ( !iommu )
{
- amd_iov_error("Fail to find iommu."
+ AMD_IOMMU_DEBUG("Fail to find iommu."
" %x:%x.%x cannot be removed from domain %d\n",
pdev->bus, PCI_SLOT(pdev->devfn),
PCI_FUNC(pdev->devfn), pdev->domain->domain_id);